package com.example.mobile2021606129ly0330;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    private Button butEasy;
    private Button butMax;
    private Button butMima;
    private Button butTem;
    private Button butFen;
    private Button butCheng;
    private Button butNum;
    private Button butLi;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();

//1.简单a+b
        butEasy.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(MainActivity.this,MainActivity_easy.class);
                startActivity(intent);
                finish();
            }
        });
        //2.三个数最大值
        butMax.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(MainActivity.this,MainActivity_max.class);
                startActivity(intent);
                finish();
            }
        });
   //3.密码破译
        butMima.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(MainActivity.this,MainActivity_mima.class);
                startActivity(intent);
                finish();
            }
        });
      //4.温度转换
        butTem.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(MainActivity.this,MainActivity_temp.class);
                startActivity(intent);
                finish();
            }
        });
        //5.分段函数求值
        butFen.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(MainActivity.this,MainActivity_fen.class);
                startActivity(intent);
                finish();
            }
        });
     //6.成绩评定
        butCheng.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(MainActivity.this,MainActivity_cheng.class);
                startActivity(intent);
                finish();
            }
        });
        //7.数字的处理与判断(未做)
        butNum.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(MainActivity.this,MainActivity_num.class);
                startActivity(intent);
                finish();
            }
        });
        //8.利润计算(未做)
        butLi.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(MainActivity.this,MainActivity_li.class);
                startActivity(intent);
                finish();
            }
        });


    }

    private void initView() {
        butEasy = (Button) findViewById(R.id.but_easy);
        butMax = (Button) findViewById(R.id.but_max);
        butMima = (Button) findViewById(R.id.but_mima);
        butTem = (Button) findViewById(R.id.but_tem);
        butFen = (Button) findViewById(R.id.but_fen);
        butCheng = (Button) findViewById(R.id.but_cheng);
        butNum = (Button) findViewById(R.id.but_num);
        butLi = (Button) findViewById(R.id.but_li);
    }
}